package com.study.app.net

import com.lbj.core.net.CoreNetApi
import com.study.app.api.API
import com.study.app.api.ServiceApi
import okhttp3.OkHttpClient

/**
 * 作者：李炳军
 * 创建日期：2021-03-29  15:16
 * 释义：
 */
object NetApi : CoreNetApi() {
    //封装ServiceApi变量 方便直接快速调用
    val api: ServiceApi by lazy {
        getApi(ServiceApi::class.java, API.BASE_URL)
    }

    override fun setHttpClientBuilder(builder: OkHttpClient.Builder): OkHttpClient.Builder {
        return builder.apply {
            // 添加头信息
            addInterceptor(HeaderInterceptor())
        }
    }
}